
package com.example.passwordguard;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import androidx.appcompat.app.AppCompatActivity;
import java.util.List;

public class ViewPasswords extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_passwords);

        ListView listView = findViewById(R.id.passwordListView);
        PasswordDatabase dbHelper = new PasswordDatabase(this);
        List<String> passwords = dbHelper.getAllPasswords();

        ArrayAdapter<String> adapter = new ArrayAdapter<>(
                this,
                android.R.layout.simple_list_item_1,
                passwords
        );
        listView.setAdapter(adapter);
    }
}